{if empty($view) || $view=='classement'}
<div class="calendrier">
{if ($display.classement || $display.complet)}
  {if count($ranking->scores)>0}
    <h1>Classements</h1>
    <div>
      <table>
        <colgroup>
          <col />
          <col />
          <col />
          <col />
          <col />
          <col />
          <col />
          <col />
          <col />
        </colgroup>
      <tr>
          <th>&nbsp;</th>
          <th>Equipe</th>
          <th><abbr title="Points">Pts.</abbr></th>
          <th><abbr title="Matchs joués">MJ</abbr></th>
          <th><abbr title="Matchs gagnés">MG</abbr></th>
          <th><abbr title="Egalités">&equals;</abbr></th>
          <th><abbr title="Points pour">PP</abbr></th>
          <th><abbr title="Points contre">PC</abbr></th>
          <th><abbr title="Différence">Diff.</abbr></th>
      </tr>
      {assign var=pos value="1"}
      {assign var=old_pts value=0}
      {foreach from=$ranking->scores key=key item=resultat}
          <tr>
              <td>
              {if $old_pts!=$resultat.points}
                  {$pos}
              {else}
                  -
              {/if}
              {assign var=pos value=$pos+1}
              {assign var=old_pts value=$resultat.points}
              </td>
              <td>{equipe_link id=$resultat.equipe_id truncate=30}</td>
              <td>{$resultat.points}</td>
              <td>{$resultat.joues}</td>
              <td>{$resultat.gagnes}</td>
              <td>{$resultat.egalites}</td>
              <td>{$resultat.pp}</td>
              <td>{$resultat.pc}</td>
              <td>{$resultat.diff}</td>
          </tr>
      {/foreach}
      {if $ranking->warn}
          <tr>
              <th colspan="8">
                <a href="#" class="warn-link">Besoin d'explications?</a>
                {literal}
                <script>
                jQuery(function(){
                  jQuery('.warn-link').click(function(e){
                    var $this = jQuery(this);
                    e.stopPropagation();
                    e.cancelBubble=true;
                    $this.next().toggle('slideDown');
                  });
                });
                </script>
                {/literal}
                <div id="explication-classement" style="font-weight: normal; text-align:left;display: none;">
                    <h2>En cas d'égalité entre deux équipes la règle suivante s'applique pour determiner le meilleur des deux :</h2>
                    <ol>
                        <li>Le plus grand nombre de victoires sur l’ensemble des matches.
                        <li>La plus grande différence entre points marqués et points concédés sur l’ensemble des matches (goal-average).
                        <li>La différence des points de la confrontation directe en cas d’égalité.</li>
                        <li>L'ordre alphabétique</li>
                    </ol>
                </div>
              </th>
          </tr>
      {/if}
      </table>
    </div>
    {else}
    <h1>Equipes</h1>
    <div>
      <ul>
      {foreach from=$equipes item=equipe}
        <li>{equipe_link id=$equipe.equipe_id}</li>
      {/foreach}
      </ul>
    </div>
    {/if}
  {/if}
  {if ($display.demies || $display.complet) && (count($ranking->demies)>0 && count($ranking->matchs)>0)}
    <h1>Phases finales {if !$ranking->demiesOk}<u>potentielles</u>{/if}</h1>
    <div class="demies">
      <table>
          <tbody>
              <tr>
                  <th class="col-1">&nbsp;</th>
                  <th class="col-2">Date</th>
                  <th class="col-3">Equipes</th>
                  {if $ranking->demiesOk}<th class="col-4">Scores</th>{/if}
              </tr>
              <tr class="match-{$ranking->demies[0].match_id}">
                  <td class="col-1">Demi-finale A</td>
                  <td class="col-2">{$ranking->demies[0].match_date|date_format}</td>
                  <td class="col-3">{score match_id=$ranking->demies[0].match_id equipeA=$ranking->demies[0].match_equipe_A equipeB=$ranking->demies[0].match_equipe_B scoreA=$ranking->demies[0].match_score_A scoreB=$ranking->demies[0].match_score_B truncate=30 notPlayed=false}</td>
                  {if $ranking->demiesOk}
                  <td class="col-4">{score match_id=$ranking->demies[0].match_id scoreA=$ranking->demies[0].match_score_A scoreB=$ranking->demies[0].match_score_B}</td>
                  {/if}
              </tr>
              <tr class="match-{$ranking->demies[1].match_id}">
                  <td class="col-1">Demi-finale B</td>
                  <td class="col-2">{$ranking->demies[1].match_date|date_format}</td>
                  <td class="col-3">{score match_id=$ranking->demies[1].match_id equipeA=$ranking->demies[1].match_equipe_A equipeB=$ranking->demies[1].match_equipe_B scoreA=$ranking->demies[1].match_score_A scoreB=$ranking->demies[1].match_score_B truncate=30 notPlayed=false}</td>
                  {if $ranking->demiesOk}
                  <td class="col-4">{score match_id=$ranking->demies[1].match_id scoreA=$ranking->demies[1].match_score_A scoreB=$ranking->demies[1].match_score_B}</td>
                  {/if}
              </tr>
              {if isset($ranking->demies[2])} {* && ($ranking->demies[2].match_equipe_A >0 || $ranking->demies[2].match_equipe_B>0)}				*}
              <tr class="match-{$ranking->demies[2].match_id}">
                  <td class="col-1">Finale</td>
                  <td class="col-2">{$ranking->demies[2].match_date|date_format}</td>
                  <td class="col-3">{score match_id=$ranking->demies[2].match_id equipeA=$ranking->demies[2].match_equipe_A equipeB=$ranking->demies[2].match_equipe_B scoreA=$ranking->demies[2].match_score_A scoreB=$ranking->demies[2].match_score_B truncate=30}</td>
                  <td class="col-4">{score match_id=$ranking->demies[2].match_id scoreA=$ranking->demies[2].match_score_A scoreB=$ranking->demies[2].match_score_B}</td>
              </tr>
              {/if}
          </tbody>
      </table>
    </div>
    {/if}
    {if ($display.matchs || $display.complet) && count($matchs)>0}
    <h1>Matchs</h1>
    <div>
      <table>
      <tr>
      <th>Date</th><th>Equipe A</th><th>Equipe B</th><th>Score</th>
      </tr>
      {foreach from=$matchs key=key item=match}
        {if $match.match_score_A!=0 && $match.match_score_B!=0}
        <tr>
          <td>{$match.match_date|date_format}</td>
          <td>{score equipeA=$match.match_equipe_A scoreA=$match.match_score_A scoreB=$match.match_score_B truncate=30}</td>
          <td>{score equipeB=$match.match_equipe_B scoreA=$match.match_score_A scoreB=$match.match_score_B truncate=30}</td>
          <td>{score scoreA=$match.match_score_A scoreB=$match.match_score_B}</td>
        </tr>
        {/if}
      {/foreach}
      </table> 
    </div>
    {/if}
    {if count($display.matchs)==0}
    <h1>Aucune information disponible</h1>
    <div>
    </div>
    {/if}
</div>
{/if}